<html>
<head><meta charset="utf-8"><title>pat_2021 on 2018 · edition 2021 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/index.html">edition 2021</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html">pat_2021 on 2018</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243604366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243604366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243604366">(Jun 23 2021 at 03:44)</a>:</h4>
<p>Now that all my projects are reporting the OR_PATTERNS_BACK_COMPAT lint, it has me wondering what the intended fix is for people who want to migrate to the 2021 version. If I follow the lint's suggestion and use <code>pat_param</code> everywhere, then when 2021 comes around the code will still work but I won't be using <code>pat</code> like I would like. On the other hand, if I just ignore the warning, then in 2021 I will be able to use the migration and get a better result. So that seems like a perverse incentive to silence the lint (a future incompatible lint, no less).</p>
<p>Would it be possible to introduce a <code>k#pat2021</code> matcher that works in old editions and can be cleaned up by a lint in 2021 edition? That would allow me to make the meaningful migration now, in advance of the edition boundary, and the second step can be fully automatic and pain free.</p>



<a name="243604895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243604895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243604895">(Jun 23 2021 at 03:59)</a>:</h4>
<p>It was decided (<a href="https://github.com/rust-lang/rust/pull/83386#issuecomment-827890256">around here</a>) to remove the pat2021 matcher.</p>
<p>I would say, after migrating to 2021, just search/replace <code>pat_param</code> and change them to <code>pat</code> if that's what you want.</p>



<a name="243605470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243605470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243605470">(Jun 23 2021 at 04:14)</a>:</h4>
<p>I guess it would be good to have a (clippy?) lint that detects uses of <code>$($pat:pat_param)|+</code> in edition 2021 then. That should be roughly equivalent. Without the lint, I doubt I will remember to go back and fix the code in N months</p>



<a name="243607250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243607250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243607250">(Jun 23 2021 at 05:00)</a>:</h4>
<p>Now that we have the syntax reservation, I wonder if we could introduce a <code>k2021#pat</code>, which would mean "this keyword with the meaning it would have in the 2021 edition".</p>



<a name="243608744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243608744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243608744">(Jun 23 2021 at 05:34)</a>:</h4>
<p>I did mention edition migration prefixes as one of the potential uses for reserved prefixes in the RFC</p>



<a name="243608755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243608755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243608755">(Jun 23 2021 at 05:34)</a>:</h4>
<p>so hopefully the question is "should" rather than "could" :)</p>



<a name="243623191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243623191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243623191">(Jun 23 2021 at 08:52)</a>:</h4>
<blockquote>
<p>reporting the OR_PATTERNS_BACK_COMPAT lint</p>
</blockquote>
<p>that sounds like that shouldn't happen. did we not make that lint allow-by-default? :S</p>



<a name="243623390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243623390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243623390">(Jun 23 2021 at 08:54)</a>:</h4>
<p>note that the new <code>$_:pat</code> isn't identical to <code>$($_:pat_param)|+</code>. the former allows leading <code>|</code>s too.</p>



<a name="243623860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243623860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243623860">(Jun 23 2021 at 08:59)</a>:</h4>
<blockquote>
<p>introduce a <code>k2021#pat</code>, which would mean "this keyword with the meaning it would have in the 2021 edition".</p>
</blockquote>
<p>you can already do that using the <code>rust-2021</code> crate:   ;)</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">rust_2021</span><span class="o">!</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="fm">macro_rules!</span><span class="w"> </span><span class="n">z</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">(</span><span class="cp">$x</span>:<span class="nc">pat</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{};</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>(nightly only)</p>



<a name="243624041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624041">(Jun 23 2021 at 09:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="310399">Mara</span> <a href="#narrow/stream/268952-edition-2021/topic/pat_2021.20on.202018/near/243623191">said</a>:</p>
<blockquote>
<blockquote>
<p>reporting the OR_PATTERNS_BACK_COMPAT lint</p>
</blockquote>
<p>that sounds like that shouldn't happen. did we not make that lint allow-by-default? :S</p>
</blockquote>
<p>I didn't realize it when I posted that, but I have a giant "turn everything on" lint section in my projects, and among the lint settings is <code>warn(future_incompatible)</code></p>



<a name="243624052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624052">(Jun 23 2021 at 09:01)</a>:</h4>
<p>ah, that explains</p>



<a name="243624084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624084">(Jun 23 2021 at 09:01)</a>:</h4>
<p>but maybe we shouldn't include edition things in that</p>



<a name="243624105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624105">(Jun 23 2021 at 09:01)</a>:</h4>
<p>because these aren't things that will just break at a point in the future at a new release or something</p>



<a name="243624124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624124">(Jun 23 2021 at 09:02)</a>:</h4>
<p>well, this one will, I think</p>



<a name="243624175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624175">(Jun 23 2021 at 09:02)</a>:</h4>
<p>only when upgrading to the new edition, right?</p>



<a name="243624283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624283">(Jun 23 2021 at 09:03)</a>:</h4>
<p>right... oh I see you mean you want to reserve <code>future_incompatible</code> to things that will break in future versions of the compiler without an edition change</p>



<a name="243624300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624300">(Jun 23 2021 at 09:03)</a>:</h4>
<p>yeah exactly. things where your code will just break if you don't do anything</p>



<a name="243624337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624337">(Jun 23 2021 at 09:03)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="224872">@rylev</span> ^</p>



<a name="243624406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624406">(Jun 23 2021 at 09:04)</a>:</h4>
<p>doesn't that violate rust backward compatibility? the only things in that category should be incredibly rare</p>



<a name="243624449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624449">(Jun 23 2021 at 09:04)</a>:</h4>
<p>yes, those are very rare. mostly bug fixes. accidental accepted unsoundness etc.</p>



<a name="243624471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624471">(Jun 23 2021 at 09:04)</a>:</h4>
<p>i don't think we have any allow-by-default lints in that category</p>



<a name="243624508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624508">(Jun 23 2021 at 09:05)</a>:</h4>
<p>do you remember why you added <code>warn(future_incompatible)</code>?</p>



<a name="243624535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624535">(Jun 23 2021 at 09:05)</a>:</h4>
<p>It seems like a pretty logical thing to want to be warned about</p>



<a name="243624569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624569">(Jun 23 2021 at 09:05)</a>:</h4>
<p>yeah but i think all those warnings (except some edition-related ones) are already enabled by default anyway</p>



<a name="243624620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624620">(Jun 23 2021 at 09:06)</a>:</h4>
<p>I try to stay on top of changes to rust and so advance warning is always good (provided I can actually do something useful about it)</p>



<a name="243624715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624715">(Jun 23 2021 at 09:07)</a>:</h4>
<p>let's see.. ah, we do have two lints that are allow by default that are not edition lints. "pointers are not structural-match" and "trailing semicolon in macro body used as expression"</p>



<a name="243624727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624727">(Jun 23 2021 at 09:07)</a>:</h4>
<p>I believe my selection process for the big list was to turn on literally everything and then remove all the lints that had low value, disagree with my style or have high false positive rates</p>



<a name="243624813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624813">(Jun 23 2021 at 09:08)</a>:</h4>
<p>interesting. i rarely see people enable extra lints, only disable some in some specific cases.</p>



<a name="243624845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624845">(Jun 23 2021 at 09:09)</a>:</h4>
<p>I believe originally the compiler only had the idea of future incompatible changes being breaking changes (usually due to soundness issues). Edition related future incompatible changes were added later. The idea of what a future incompatible change is has been somewhat fluid, and I think we’re only now really getting a good idea of what that mechanism is</p>



<a name="243624899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624899">(Jun 23 2021 at 09:09)</a>:</h4>
<p>cargo also has this mechanism for showing these kind of backwards compatibility lints even for dependencies, even though lints are normally suppressed for (remote) dependencies</p>



<a name="243624955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624955">(Jun 23 2021 at 09:10)</a>:</h4>
<p>Oh I see, I actually filed a bug report about that a few hours ago</p>



<a name="243624966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243624966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243624966">(Jun 23 2021 at 09:10)</a>:</h4>
<p>oh, do you have a link?</p>



<a name="243625027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243625027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243625027">(Jun 23 2021 at 09:10)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/86567">#86567</a></p>



<a name="243625287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243625287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243625287">(Jun 23 2021 at 09:12)</a>:</h4>
<p>for edition-based future incompat lints, I think it is definitely wrong to warn on use in dependencies, since that won't actually break even if you upgrade your edition</p>



<a name="243626207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243626207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243626207">(Jun 23 2021 at 09:23)</a>:</h4>
<p>yeah, that's a bug! but already on stable i'm afraid. :(</p>



<a name="243626584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243626584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243626584">(Jun 23 2021 at 09:27)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> does your PR fix this too?</p>



<a name="243626827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243626827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243626827">(Jun 23 2021 at 09:30)</a>:</h4>
<p>Hmmm… there is logic already to avoid warning in dependencies. I’ll take a closer look at this.</p>



<a name="243626889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243626889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243626889">(Jun 23 2021 at 09:31)</a>:</h4>
<p>Yeah, --cap-lints. but then there's a second mechanism to forward future incompatibility lints. but we shouldn't do that for edition stuff</p>



<a name="243626934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243626934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243626934">(Jun 23 2021 at 09:31)</a>:</h4>
<p>and we should probably not add them to the <code>future_incompatible</code> group either. So an <code>else</code> in <code>compiler/rustc_lint/src/context.rs</code> around line 224 i suppose.</p>



<a name="243627022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243627022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243627022">(Jun 23 2021 at 09:32)</a>:</h4>
<p>Yep. I’m not at my computer right now, but I have it on my todo list for today to look into the cap-lints issue and I can look into this today too</p>



<a name="243627042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243627042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243627042">(Jun 23 2021 at 09:32)</a>:</h4>
<p>thank you!</p>



<a name="243627469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243627469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243627469">(Jun 23 2021 at 09:36)</a>:</h4>
<p><span class="user-mention" data-user-id="271719">@Mario Carneiro</span> </p>
<blockquote>
<p>This lint should be suppressed, because it originates in another crate.</p>
</blockquote>
<p>Note that that is not the case for crates that are a <code>{ path = .. }</code> dependency. Only 'remote' dependencies get --cap-lints passed automatically.</p>



<a name="243628170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243628170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243628170">(Jun 23 2021 at 09:44)</a>:</h4>
<p>okay, with <code>git = "file://"</code>, same things happens.</p>



<a name="243628211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243628211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243628211">(Jun 23 2021 at 09:44)</a>:</h4>
<p>looks like the warning is emitted when the macro_rules is used, not just when it is defined. so that might be a bug specifically with the or pattern lint, not with the future incompatibility lint mechanism</p>



<a name="243637607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243637607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243637607">(Jun 23 2021 at 11:28)</a>:</h4>
<p><span class="user-mention" data-user-id="310399">@Mara</span> Are you saying above that the --cap-lints allow is being passed to the dependency but it is still warning?</p>



<a name="243640535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243640535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243640535">(Jun 23 2021 at 11:59)</a>:</h4>
<p>I've been able to reproduce the issue in a test. I'm unsure why <a href="https://github.com/rust-lang/rust/blob/b6f3cb9502b1910f6af32f426fdb78e813b390ef/compiler/rustc_middle/src/lint.rs#L282-L302">this code</a> does not prevent the lint from firing.</p>



<a name="243642145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243642145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243642145">(Jun 23 2021 at 12:14)</a>:</h4>
<p>Looks like the span is not seen as coming from an external macro</p>



<a name="243643056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243643056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243643056">(Jun 23 2021 at 12:23)</a>:</h4>
<p>The span for or pattern has a ExpnKind::Root. I'm not super up to speed on expansion, but does that make sense? Perhaps <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> can help? Is a macro_rules macro pattern considered a part of root expansion?</p>



<a name="243643303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243643303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243643303">(Jun 23 2021 at 12:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="310399">Mara</span> <a href="#narrow/stream/268952-edition-2021/topic/pat_2021.20on.202018/near/243628211">said</a>:</p>
<blockquote>
<p>looks like the warning is emitted when the macro_rules is used, not just when it is defined. so that might be a bug specifically with the or pattern lint, not with the future incompatibility lint mechanism</p>
</blockquote>
<p>I guess this matches up with what <span class="user-mention" data-user-id="310399">@Mara</span> was saying</p>



<a name="243647897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243647897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243647897">(Jun 23 2021 at 13:03)</a>:</h4>
<p>i think the macro_rules gets parsed <em>again</em> when compiling the crate that uses it</p>



<a name="243647919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243647919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243647919">(Jun 23 2021 at 13:03)</a>:</h4>
<p>and then produces a warnings too, in that crate.</p>



<a name="243648067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243648067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243648067">(Jun 23 2021 at 13:04)</a>:</h4>
<blockquote>
<p>Are you saying above that the --cap-lints allow is being passed to the dependency but it is still warning?</p>
</blockquote>
<p><span class="user-mention" data-user-id="224872">@rylev</span> yes, kind of. The <code>rustc</code> invocation with <code>--cap-lints</code> to compile the crate that contains the macro_rules definition does <em>not</em> produce the warning. (even without --cap-lints. as the lint is set to allow there by default). the warning is produced by the <code>rustc</code> invocation on the binary crate that uses it</p>



<a name="243648304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243648304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243648304">(Jun 23 2021 at 13:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="310399">Mara</span> <a href="#narrow/stream/268952-edition-2021/topic/pat_2021.20on.202018/near/243647897">said</a>:</p>
<blockquote>
<p>i think the macro_rules gets parsed <em>again</em> when compiling the crate that uses it</p>
</blockquote>
<p>Yes it kind of seems like this is the case. I have no idea if that is a bug or if that needs to happen, and I'm not sure how the lint could track whether that's the case.</p>



<a name="243648656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243648656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243648656">(Jun 23 2021 at 13:10)</a>:</h4>
<p>checking now where <code>compile_macro()</code> is called from</p>



<a name="243648807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243648807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243648807">(Jun 23 2021 at 13:11)</a>:</h4>
<p>looks like there is a def_id with a .is_local() function to check if it  comes from the crate that's currently being compiled</p>



<a name="243649037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243649037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243649037">(Jun 23 2021 at 13:13)</a>:</h4>
<p>Do you mean inside <code>get_macro_by_def_id</code>?</p>



<a name="243649063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243649063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243649063">(Jun 23 2021 at 13:13)</a>:</h4>
<p>Looks like you are discussing <a href="https://github.com/rust-lang/rust/issues/85708">https://github.com/rust-lang/rust/issues/85708</a>.</p>



<a name="243649189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243649189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243649189">(Jun 23 2021 at 13:14)</a>:</h4>
<p>Hmm yes definitely looks like it</p>



<a name="243649213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243649213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243649213">(Jun 23 2021 at 13:14)</a>:</h4>
<p>yeah i guess that might be the root cause. compile_macro() happens again in every crate that uses a macro_rules? not just while compiling the crate that defined it?</p>



<a name="243649409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243649409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243649409">(Jun 23 2021 at 13:16)</a>:</h4>
<blockquote>
<p>However, it should be possible to make a hack that just fixes the problems for macros: when we're checking the span of a token for a foreign macro, fall back to the edition of that foreign crate if the is .</p>
</blockquote>
<p>Is there an easy way to check that a span is coming from a different crate?</p>



<a name="243650050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243650050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243650050">(Jun 23 2021 at 13:20)</a>:</h4>
<blockquote>
<p>compile_macro() happens again in every crate that uses a macro_rules? not just while compiling the crate that defined it?</p>
</blockquote>
<p>Yes.</p>
<blockquote>
<p>Is there an easy way to check that a span is coming from a different crate?</p>
</blockquote>
<p>Generally yes, but not for non-macro-expanded spans due to the aforementioned issue.</p>



<a name="243650162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243650162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243650162">(Jun 23 2021 at 13:21)</a>:</h4>
<p>Instead of using the span, would checking DefId.is_local() work at the place where compile_macro is called?</p>



<a name="243650167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243650167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243650167">(Jun 23 2021 at 13:21)</a>:</h4>
<p>That's why the workaround in <a href="https://github.com/rust-lang/rust/pull/85709">https://github.com/rust-lang/rust/pull/85709</a> takes the edition from somewhere else.</p>



<a name="243650307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243650307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243650307">(Jun 23 2021 at 13:22)</a>:</h4>
<p>If the def-id is the macro definition's def-id, then yes.</p>



<a name="243650348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243650348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243650348">(Jun 23 2021 at 13:22)</a>:</h4>
<p>I can check that</p>



<a name="243650419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243650419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243650419">(Jun 23 2021 at 13:23)</a>:</h4>
<p>already implemented it, just waiting for it to compile.. :)</p>



<a name="243651183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243651183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243651183">(Jun 23 2021 at 13:28)</a>:</h4>
<p>yeah that works</p>



<a name="243651224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243651224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243651224">(Jun 23 2021 at 13:28)</a>:</h4>
<p>no more warning from the dep, but still a warning from a locally defined macro_rules. <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="243651321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243651321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243651321">(Jun 23 2021 at 13:29)</a>:</h4>
<p>YAY! Do you push the change?</p>



<a name="243651401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243651401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243651401">(Jun 23 2021 at 13:30)</a>:</h4>
<p>i'll open a PR once i cleaned it up a bit</p>



<a name="243651487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243651487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243651487">(Jun 23 2021 at 13:30)</a>:</h4>
<p>Are you just passing a is_local bool all the way down the call stack until the lint check?</p>



<a name="243651654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243651654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243651654">(Jun 23 2021 at 13:31)</a>:</h4>
<p>yeah kind of. checking now if i can just disable lints entirely when compiling remote macro_rules. seems like a better solution.</p>



<a name="243653040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243653040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243653040">(Jun 23 2021 at 13:42)</a>:</h4>
<p><span class="user-mention" data-user-id="310399">@Mara</span> FYI: we don't disable future_compatibility lints that are not edition changes. This is so users know that their dependency will break at some point</p>



<a name="243653106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243653106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243653106">(Jun 23 2021 at 13:42)</a>:</h4>
<p>yes</p>



<a name="243674021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243674021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243674021">(Jun 23 2021 at 16:02)</a>:</h4>
<blockquote>
<p>i'll open a PR once i cleaned it up a bit</p>
</blockquote>
<p>oops, got distracted.</p>
<p>here it is: <a href="https://github.com/rust-lang/rust/pull/86574">https://github.com/rust-lang/rust/pull/86574</a></p>



<a name="243683706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243683706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243683706">(Jun 23 2021 at 17:17)</a>:</h4>
<p>Looks great! I also like the cleanup of that big rightward drift where the lint was being emitted.</p>



<a name="243683925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243683925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243683925">(Jun 23 2021 at 17:18)</a>:</h4>
<p>yeah i had to add one more level, which was starting to get a bit too much ^^'</p>



<a name="243684019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243684019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243684019">(Jun 23 2021 at 17:19)</a>:</h4>
<p>but in this case there were no bindings from the patterns needed, so <code>matches!()</code> worked fine</p>



<a name="243684030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243684030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243684030">(Jun 23 2021 at 17:19)</a>:</h4>
<p>can't wait for let_chains though ^^</p>



<a name="243697632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243697632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243697632">(Jun 23 2021 at 19:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/268952-edition-2021/topic/pat_2021.20on.202018/near/243624283">said</a>:</p>
<blockquote>
<p>right... oh I see you mean you want to reserve <code>future_incompatible</code> to things that will break in future versions of the compiler without an edition change</p>
</blockquote>
<p>yes please</p>



<a name="243700955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243700955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243700955">(Jun 23 2021 at 19:31)</a>:</h4>
<p>should there be a separate lint group for <code>edition_incompatible</code>? <code>migration_hazard</code>?</p>



<a name="243768399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243768399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243768399">(Jun 24 2021 at 10:56)</a>:</h4>
<p>It seems like the term "future incompatible" has been understood by people in different ways. I think <span class="user-mention" data-user-id="224872">@rylev</span>'s PR distinguished various categories well. I would want to distinguish:</p>
<ul>
<li><em>breaking change</em>: code that may break or change meaning when upgrading to a new version of rustc (rare)</li>
<li><em>edition change</em>: code that may break or change meaning when upgrading to a new edition (common, automated)</li>
</ul>



<a name="243768415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243768415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243768415">(Jun 24 2021 at 10:56)</a>:</h4>
<p>right now we treat those like two 'flavors' of future-incompatibility</p>



<a name="243768421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243768421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243768421">(Jun 24 2021 at 10:56)</a>:</h4>
<p>personally they seem completely different to me</p>



<a name="243768475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243768475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243768475">(Jun 24 2021 at 10:57)</a>:</h4>
<p>so I agree, <span class="user-mention" data-user-id="271719">@Mario Carneiro</span>, that we should have a distinct lint group for edition changes</p>



<a name="243771479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243771479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243771479">(Jun 24 2021 at 11:31)</a>:</h4>
<p>we already have lint groups for each edition</p>



<a name="243771558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243771558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243771558">(Jun 24 2021 at 11:32)</a>:</h4>
<p>so we just need an <code>else</code> in <code>compiler/rustc_lint/src/context.rs</code> around line 224</p>



<a name="243775544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243775544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243775544">(Jun 24 2021 at 12:12)</a>:</h4>
<p>I was going to tackle this in a little bit unless <span class="user-mention" data-user-id="271719">@Mario Carneiro</span> wanted to work on it.</p>



<a name="243783561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243783561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243783561">(Jun 24 2021 at 13:15)</a>:</h4>
<p>Going to look into this now</p>



<a name="243786045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243786045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243786045">(Jun 24 2021 at 13:34)</a>:</h4>
<p>Should have a PR soon - just running tests and such</p>



<a name="243791759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243791759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243791759">(Jun 24 2021 at 14:10)</a>:</h4>
<p><span class="user-mention" data-user-id="310399">@Mara</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> FYI: <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/future-incompatible-lint-group.rs">the test</a> for the <code>future_incompatible</code> lint group tests against a lint that we are proposing does not qualify as a future incompatible lint (but rather an edition lint). Does this change require any larger consensus before we make it? While this isn't a breaking change, it could impact users in significant ways.</p>



<a name="243793126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243793126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243793126">(Jun 24 2021 at 14:20)</a>:</h4>
<p>i think when the 2018 edition happened there was a bit more push towards leaving the old edition behind, instead of just considering them variants of rust we support in parallel.</p>



<a name="243802556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243802556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243802556">(Jun 24 2021 at 15:24)</a>:</h4>
<p>Here's the changes: <a href="https://github.com/rylev/rust/compare/update-fcw-handling...rylev:future-compat-lint-group">https://github.com/rylev/rust/compare/update-fcw-handling...rylev:future-compat-lint-group</a> I'll open a PR when <a href="https://github.com/rust-lang/rust/pull/86330">https://github.com/rust-lang/rust/pull/86330</a> is merged</p>



<a name="243806206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243806206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243806206">(Jun 24 2021 at 15:49)</a>:</h4>
<p>looks like you force-pushed that PR after the approval. then it needs re-approval i think</p>



<a name="243806787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243806787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243806787">(Jun 24 2021 at 15:53)</a>:</h4>
<p>reapproved it and put it in a rollup. should be merged in a few hours.</p>



<a name="243816234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/243816234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#243816234">(Jun 24 2021 at 17:06)</a>:</h4>
<p>Whoops sorry! I wish I had the ability to r+ even just other people <span aria-label="blush" class="emoji emoji-1f60a" role="img" title="blush">:blush:</span></p>



<a name="244156510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/244156510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#244156510">(Jun 28 2021 at 14:51)</a>:</h4>
<p>Here's the change for not including edition lints in <code>future_incompatible</code> lint group: <a href="https://github.com/rust-lang/rust/pull/86689">https://github.com/rust-lang/rust/pull/86689</a></p>



<a name="244157625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/pat_2021%20on%202018/near/244157625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/pat_2021.20on.202018.html#244157625">(Jun 28 2021 at 14:58)</a>:</h4>
<p>reviewing now :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>